@import url('https://fonts.googleapis.com/css2?family=Inter:wght@500;700&display=swap');
@import url('tldraw/tldraw.css');

* {
	box-sizing: border-box;
	overscroll-behavior: none;
}

body {
	font-family: 'Inter', sans-serif;
}

.tldraw-agent-container {
	position: fixed;
	inset: 0;
	display: grid;
	grid-template-columns: 1fr 350px;
}

@media (max-width: 768px) {
	.tldraw-agent-container {
		grid-template-columns: 1fr;
		grid-template-rows: 1fr auto;
	}
}

.tldraw-canvas {
	width: 100%;
	height: 100%;
}

/* Chat Panel */

.chat-panel.tl-theme__light {
	--tl-color-text-2: hsl(0, 0%, 55%);
	--tl-color-primary-hover: hsl(214, 84%, 58%);
}

.chat-panel.tl-theme__dark {
	--tl-color-text-2: hsl(0, 0%, 55%);
	--tl-color-primary-hover: hsl(214, 84%, 50%);
}

.chat-panel {
	display: flex;
	flex-direction: column;
	height: 100vh;
	font-size: 14px;
	background-color: var(--tl-color-panel);
	border-left: 1px solid var(--tl-color-low);
	color: var(--tl-color-text-1);
	font-family: 'Inter', sans-serif;
	font-weight: 400;
	font-size: 12px;
	line-height: 1.5;
}

@media (max-width: 768px) {
	.chat-panel {
		height: 50vh;
		width: 100vw;
	}
}

.chat-panel {
	position: relative;
}

.chat-panel * {
	user-select: text;
}

.chat-panel button {
	user-select: none;
}

.chat-header {
	display: flex;
	justify-content: flex-end;
}

.new-chat-button {
	width: 32px;
	height: 32px;
	font-size: 16px;
	align-self: flex-end;
	appearance: none;
	border: 0;
	border-radius: 4px;
	cursor: pointer;
	background: none;
	margin: 2px;
	color: var(--tl-color-text);
}

.new-chat-button:hover {
	background-color: var(--tl-color-muted-2);
}

/* Chat Input */
.chat-input-container {
	display: flex;
	flex-direction: column;
	position: relative;
}

.chat-input {
	padding: 0px 8px 8px 8px;
	flex-shrink: 0;
	position: sticky;
	bottom: 0;
	border-radius: 12px;
	margin: 0px 8px 8px 8px;
	padding: 0px;
	background-color: var(--tl-color-panel);
	z-index: 999999;
}

.chat-input form {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 8px;
	border-radius: 12px;
	color: var(--tl-color-text-2);
	background-color: var(--tl-color-muted-1);
	box-shadow: var(--tl-shadow-1);
	font-size: 11px;
}

.chat-input input[type='text'] {
	flex: 1;
	padding: 8px 0px;
	margin-bottom: 4px;
	border: none;
	background-color: transparent;
	color: var(--tl-color-text);
	border-radius: 4px;
	font-size: 12px;
	outline: none;
	width: 100%;
}

.chat-input input[type='text']::placeholder {
	color: var(--tl-color-text-3);
}

.chat-input input[type='text']:focus {
	border-color: var(--tl-color-primary);
}

.chat-input textarea {
	flex: 1;
	padding: 8px 0px;
	margin-bottom: 4px;
	border: none;
	background-color: transparent;
	color: var(--tl-color-text);
	font-family: sans-serif;
	border-radius: 4px;
	font-size: 12px;
	outline: none;
	width: 100%;
	resize: none;
	scrollbar-color: var(--tl-color-text-3) transparent;
}

.chat-input textarea::placeholder {
	color: var(--tl-color-text-3);
}

.chat-input textarea:focus {
	border-color: var(--tl-color-primary);
}

.chat-input textarea::-webkit-scrollbar {
	width: 8px;
	background: transparent;
}

.chat-input textarea::-webkit-scrollbar-track {
	background: transparent;
}

.chat-input textarea::-webkit-scrollbar-thumb {
	background: var(--tl-color-text-3);
	border-radius: 4px;
}

.chat-input-submit {
	width: 16px;
	height: 16px;
	align-self: flex-end;
	background: var(--tl-color-primary);
	box-shadow: var(--tl-shadow-1);
	color: var(--tl-color-panel-contrast);
	appearance: none;
	border: 0;
	border-radius: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 10px;
	text-align: center;
	font-weight: 500;
	border-radius: 100%;
}

.chat-input-submit:hover {
	background: var(--tl-color-primary-hover);
}

.chat-input-submit:disabled {
	background: var(--tl-color-grid);
	cursor: not-allowed;
}

.chat-actions {
	display: flex;
	gap: 8px;
	width: 100%;
	justify-content: space-between;
}

.chat-actions-left {
	display: flex;
	gap: 0px;
}

.chat-icon {
	width: 11px;
	height: 11px;
	margin-right: 4px;
}

.chat-mode-select {
	display: flex;
	align-items: center;
	gap: 0px;
}

.chat-mode-select span {
	margin-right: 4px;
}

.chat-context-select-label {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 10px;
}

.chat-model-select,
.chat-context-select {
	position: relative;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 0px 8px;
}

.chat-model-select-label {
	display: flex;
	align-items: center;
	gap: 2px;
	margin-left: -6px;
}

.chat-context-select {
	border: 1px solid var(--tl-color-text-2);
	padding: 0px 4px 0px 3px;
	border-radius: 6px;
	height: 18px;
}

.chat-model-select:hover,
.chat-context-select:hover {
	color: var(--tl-color-text);
	border-color: var(--tl-color-text);
}

.chat-model-select select,
.chat-context-select select {
	opacity: 0;
	position: absolute;
	left: -1px;
	right: -1px;
	background-color: transparent;
	border-radius: 6px;
	padding: 2px 16px 2px 0px;
	font-size: 11px;
	border: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	font-family: 'Inter', sans-serif;
}

.chat-context-select select {
	cursor: pointer;
	font-size: 10px;
	font-weight: 500;
	line-height: 1.5;
}

.chat-context-select.active {
	background-color: var(--tl-color-primary);
	color: black;
	border-color: black;
}

.chat-context-select.active:hover {
	background-color: var(--tl-color-primary);
	color: var(--tl-color-text);
	border-color: var(--tl-color-text);
}

/* Chat History */

.chat-history {
	padding: 0px 16px 32px 16px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 10px;
	height: 100%;
	position: relative;
	width: 100%;
	scrollbar-width: 8px;
	scrollbar-color: var(--tl-color-muted-1) transparent;
}

.chat-history::-webkit-scrollbar {
	width: 8px;
}

.chat-history::-webkit-scrollbar-track {
	background: transparent;
}

.chat-history::-webkit-scrollbar-thumb {
	background: var(--tl-color-muted-1);
	border-radius: 4px;
}

.chat-history-section {
	display: flex;
	flex-direction: column;
	gap: 14px;
	flex-shrink: 0;
}

.chat-history-section:last-child {
	min-height: calc(100% - 1px);
}

.chat-history-prompt-container {
	position: sticky;
	top: -6px;
	padding: 8px;
	margin: -8px;
	z-index: 9999;
	background-color: var(--tl-color-panel);
}

.chat-history-prompt {
	background-color: var(--tl-color-muted-1);
	box-shadow: var(--tl-shadow-1);
	color: var(--tl-color-text-1);
	width: 100%;
	font-family: 'Inter', sans-serif;
	font-weight: 400;
	font-size: 12px;
	padding: 8px;
	border-radius: 8px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	white-space: pre-wrap;
	max-height: 25vh;
	overflow-y: auto;
	scrollbar-color: var(--tl-color-text-3) transparent;
}

.chat-history-prompt::-webkit-scrollbar {
	background: transparent;
}

.chat-history-prompt::-webkit-scrollbar-thumb {
	background: var(--tl-color-text-3);
}

.chat-history-group {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.chat-history-group button {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 12px 0px;
	margin: -12px 0px;
	font-size: 12px;
	font-family: 'Inter', sans-serif;
	font-weight: 400;
	color: var(--tl-color-text-2);
	background-color: transparent;
	border: none;
	cursor: pointer;
}

.chat-history-group button:hover {
	color: var(--tl-color-text);
}

.chat-history-group button:disabled {
	color: var(--tl-color-text-1);
	cursor: default;
}

.chat-history-change-acceptance {
	display: flex;
	justify-content: flex-end;
	width: 100%;
	gap: 2px;
}

.chat-history-change-acceptance button {
	border: 0;
	cursor: pointer;
	background-color: var(--tl-color-muted-1);
	color: var(--tl-color-text-2);
	padding: 4px 8px;
	font-size: 10px;
	font-weight: 500;
	cursor: pointer;
	height: 20px;
	user-select: none;
	display: flex;
	align-items: center;
	gap: 4px;
	flex-direction: row;
	user-select: none;
}

.chat-history-change-acceptance button:hover {
	color: var(--tl-color-text);
}

.chat-history-change-acceptance button:disabled {
	color: var(--tl-color-text-1);
	cursor: default;
}

.chat-history-change-acceptance button:first-child {
	border-radius: 4px 0px 0px 0px;
}

.chat-history-change-acceptance button:last-child {
	border-radius: 0px 4px 0px 0px;
}

/* Agent Actions */

.agent-action {
	display: flex;
	align-items: flex-start;
	gap: 4px;
	font-size: 12px;
	font-family: 'Inter', sans-serif;
	font-weight: 400;
	color: var(--tl-color-text-2);
}

.agent-action-description {
	margin: 0;
	width: 100%;
}

.agent-action-description > p:first-child {
	margin-top: 0;
}

.agent-action-description > p:last-child {
	margin-bottom: 0;
}

.agent-action-description p {
	white-space: pre-wrap;
}

.agent-action-description ul,
.agent-action-description ol {
	padding-left: 20px;
}

.agent-action-description pre {
	width: 100%;
	overflow-x: scroll;
}

.agent-action-description blockquote {
	padding-left: 14px;
	border-left: 2px solid var(--tl-color-text-2);
	margin: 0;
}

.agent-actions-container {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.agent-changes {
	background-color: var(--tl-color-muted-1);
	padding: 6px 8px;
	margin: 0px 0px;
	border-radius: 4px 0px 0px 0px;
	color: var(--tl-color-text-2);
	max-height: 70px;
	overflow-y: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.agent-changes::-webkit-scrollbar {
	display: none;
}

.agent-changes:last-child {
	border-radius: 4px 0px 4px 4px;
	max-height: 100%;
}

.agent-change {
	display: flex;
	align-items: flex-start;
	gap: 4px;
	font-size: 12px;
	font-family: 'Inter', sans-serif;
	font-weight: 400;
}

/* Prompt Tags */

.prompt-tags {
	display: flex;
	gap: 4px;
	align-items: center;
	flex-wrap: wrap;
}

.prompt-tag {
	display: flex;
	align-items: center;
	border-radius: 6px;
	background-color: transparent;
	font-size: 10px;
	border: 1px solid var(--tl-color-text-2);
	padding: 8px 4px 8px 3px;
	font-weight: 500;
	height: 16px;
	color: var(--tl-color-text-2);
	white-space: nowrap;
	font-family: 'Inter', sans-serif;
	max-width: 100%;
}

button.prompt-tag {
	cursor: pointer;
}

button.prompt-tag:hover {
	color: var(--tl-color-text);
	border-color: var(--tl-color-text);
}

button.prompt-tag span {
	user-select: none;
}

.prompt-tag span {
	text-overflow: ellipsis;
	overflow: hidden;
}

.prompt-tag svg {
	flex-shrink: 0;
}

/* Diff viewer */

.tldraw-viewer {
	height: 100px;
	position: relative;
}

.tldraw-viewer .tlui-tooltip {
	display: none;
}

.diff-shape-create-shadow {
	filter: drop-shadow(
			calc(var(--tl-scale) * 1px) calc(var(--tl-scale) * 1px) 0px rgba(0, 200, 0, 50%)
		)
		drop-shadow(calc(var(--tl-scale) * -1px) calc(var(--tl-scale) * -1px) 0px rgba(0, 200, 0, 50%))
		drop-shadow(calc(var(--tl-scale) * 1px) calc(var(--tl-scale) * -1px) 0px rgba(0, 200, 0, 50%))
		drop-shadow(calc(var(--tl-scale) * -1px) calc(var(--tl-scale) * 1px) 0px rgba(0, 200, 0, 50%));
}

.diff-shape-delete-shadow {
	filter: drop-shadow(
			calc(var(--tl-scale) * 1px) calc(var(--tl-scale) * 1px) 0px rgba(200, 0, 0, 50%)
		)
		drop-shadow(calc(var(--tl-scale) * -1px) calc(var(--tl-scale) * -1px) 0px rgba(200, 0, 0, 50%))
		drop-shadow(calc(var(--tl-scale) * 1px) calc(var(--tl-scale) * -1px) 0px rgba(200, 0, 0, 50%))
		drop-shadow(calc(var(--tl-scale) * -1px) calc(var(--tl-scale) * 1px) 0px rgba(200, 0, 0, 50%));
}

.diff-shape-update-after-shadow {
	filter: drop-shadow(
			calc(var(--tl-scale) * 1px) calc(var(--tl-scale) * 1px) 0px rgba(0, 100, 255, 50%)
		)
		drop-shadow(
			calc(var(--tl-scale) * -1px) calc(var(--tl-scale) * -1px) 0px rgba(0, 100, 255, 50%)
		)
		drop-shadow(calc(var(--tl-scale) * 1px) calc(var(--tl-scale) * -1px) 0px rgba(0, 100, 255, 50%))
		drop-shadow(calc(var(--tl-scale) * -1px) calc(var(--tl-scale) * 1px) 0px rgba(0, 100, 255, 50%));
}

/* Chat History Fallback */

.chat-fallback {
	padding: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	color: var(--tl-color-text-2);
	user-select: none;
	font-size: 14px;
}

.chat-fallback button {
	background-color: hsl(214, 84%, 50%);
	color: white;
	border: none;
	border-radius: 4px;
	padding: 6px 12px;
	font-weight: 500;
	cursor: pointer;
}

.chat-fallback button:hover {
	background-color: hsl(214, 84%, 40%);
}

/* Context Highlights */

.context-highlight {
	pointer-events: none;
}

.context-highlight line {
	stroke-dasharray: 4px;
	stroke-linecap: round;
	stroke-width: 1px;
}

.context-highlight-generating line {
	animation: dash 100s linear infinite;
}

.context-highlight circle {
	stroke-width: 1px;
	pointer-events: none;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.context-highlight-generating circle {
	stroke-dasharray: 3px;
	stroke-width: 2px;
	fill: none;
	animation: dash 100s linear infinite;
}

.context-highlight-label {
	position: absolute;
	color: var(--tl-color-text-shadow);
	padding: 4px;
	font-size: 12px;
	background-color: var(--tl-color-tooltip);
	border-radius: 0px 0px 6px 0px;
	font-weight: 500;
	white-space: nowrap;
	margin-top: -0.5px;
	margin-left: -0.5px;
	pointer-events: none;
	font-family: 'Inter', sans-serif;
}

@keyframes dash {
	to {
		stroke-dashoffset: -2000;
	}
}

/* Todo list */

.todo-list {
	margin: 0px 16px -18px 16px;
	background-color: var(--tl-color-panel);
	border-radius: 12px 12px 0px 0px;
	padding: 8px 4px 0 4px;
	box-shadow: var(--tl-shadow-1);
	border: 1px solid var(--tl-color-muted-2);
	max-height: 120px;
	overflow-y: auto;
	flex-shrink: 0;
	scrollbar-width: none;
	-ms-overflow-style: none;
	position: relative;
	z-index: 99999;
	transform: translateY(-16px);
}

.todo-list::-webkit-scrollbar {
	display: none;
}

.todo-list-items {
	display: flex;
	flex-direction: column;
}

.todo-item {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	padding-left: 4px;
	border-radius: 6px;
	font-size: 12px;
	line-height: 1.3;
}

.todo-item-icon {
	font-size: 10px;
	width: 12px;
	text-align: center;
	flex-shrink: 0;
	user-select: none;
}

.todo-item-text {
	flex: 1;
	color: var(--tl-color-text-3);
	user-select: none;
	padding-bottom: 8px;
}

.todo-item-todo .todo-item-icon {
	color: var(--tl-color-text-3);
}

.todo-item-in-progress .todo-item-icon {
	color: var(--tl-color-primary);
}

.todo-item-in-progress .todo-item-text {
	font-weight: 500;
	color: var(--tl-color-text);
}

.todo-item-done .todo-item-icon {
	color: rgb(76, 200, 94);
}

.todo-item-done .todo-item-text {
	color: var(--tl-color-text-2);
	text-decoration: line-through;
}

.todo-item-delete {
	appearance: none;
	background: none;
	border: none;
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	display: flex;
	padding: 12px;
	padding-right: 14px;
	margin-right: -3px;
	margin-top: -3px;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: var(--tl-color-text-2);
}

.todo-item-delete:hover {
	color: var(--tl-color-text);
}

/* Custom appearance for specific agent actions */

.agent-action-type-message {
	color: var(--tl-color-text-1);
}
